home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / SHARED.DIR / 03084_Script_PRINT LEO II B < prev    next >
Text File  |  1996-04-01  |  10KB  |  320 lines

  1. -- ----------------------------------------------------------------
  2. -- Handler doPrintDataBaseText does the actual printing of the text
  3. -- of the selected topic in the database.
  4.  
  5. on doPrintDatabaseText printObj
  6.   global textSprite, numPagesInClickedTopic, clickedTopic
  7.   
  8.   printobj(mSetDocumentName, "Leonardo 2")
  9.   
  10.   set width = printObj(mGetPageWidth)
  11.   set height = printObj(mGetPageheight)
  12.   -- printObj(mSetPageNumSymbol,"#")
  13.   
  14.   printObj(mreset)
  15.   printObj(mSetTextFont,"helvetica")
  16.   printObj(mSetTextSize,18)
  17.   printObj(mSetTextStyle,"normal,italic")
  18.   
  19.   -- page header left side
  20.   printObj(mSetTextJust,"left")
  21.   printObj(mDrawText, clickedTopic, 0, 8)
  22.   
  23.   -- page header line underneath
  24.   printObj(mLine, 0, 11, width, 11)
  25.   
  26.   -- page footer right side
  27.   -- printObj(mSetTextSize,10)
  28.   -- printObj(mSetTextStyle,"normal")
  29.   -- printObj(mDrawText, "page #", width, height-2)
  30.   
  31.   -- page footer left side: copyright notice
  32.   printObj(mSetTextSize,10)
  33.   printObj(mSetTextStyle,"normal")
  34.   printObj (mSetTextJust,"left")
  35.   printObj (mDrawText,"⌐1996 SoftKey Multimedia Inc., a subsidiary of SoftKey International Inc.",0,height-2)
  36.   
  37.   -- the body pages
  38.   printObj(mSetTextJust,"left")
  39.   
  40.   printObj(mNewPage)
  41.   printObj(mTextBox, 0, 30, width, height-24, true)
  42.   
  43.   printObj(mSetColor,255,0,0)
  44.   printObj(mSetTextStyle,"normal")
  45.   printObj(mSetTextSize,12)
  46.   printObj(mSetGray,100)
  47.   
  48.   repeat with curPage = 1 to numPagesInClickedTopic
  49.     set currentPageText = the text of cast (clickedTopic && "TEXT" & curPage)
  50.     set numLines = the number of lines in currentPageText
  51.     if (line numLines of currentPageText = EMPTY) then
  52.       set currentPageText = line 1 to numLines - 1 of currentPageText & " "
  53.     end if
  54.     
  55.     if endsWithPunctuation(currentPageText) then
  56.       set currentPageText = currentPageText && " "
  57.     end if
  58.     
  59.     printObj(mAppendText, currentPageText, TRUE)
  60.   end repeat
  61.   
  62.   -- register the xobject
  63.   printobj(mRegister, "PMAT130-013-01075")
  64.   --  printObj(mPrintPreview)
  65.   printObj(mPrint)
  66.   
  67.   printObj(mDispose)
  68. end
  69.  
  70. -- ----------------------------------------------------------------
  71. -- Handler doPrintDataBasePicture does the actual printing of the
  72. -- picture of the selected topic in the database.
  73.  
  74. on doPrintDatabasePicture printObj
  75.   global pictureSprite, clickedTopic, captionSprite
  76.   
  77.   doPrintPicture(printObj, the castNum of sprite pictureSprite, clickedTopic, the text of cast the castnum of sprite captionSprite)
  78. end
  79.  
  80. ----------------------------------------------------------------
  81. -- Handler doPrintBGPicture prints the picture in the given pictureCast
  82. -- with the given pictureTitle and the optional pictureCapiton
  83.  
  84. -- NOTE: THIS VERSION PRINTS LARGE PICTURES IN LANDSCAPE MODE
  85. -- SCALED DOWN TO %75.
  86.  
  87. on doPrintBGPicture printObj, pictureCast, pictureTitle, pictureCaption
  88.   printobj(mSetDocumentName, "Leonardo 2")
  89.   
  90.   printObj(mreset)
  91.   printobj(msetlandscapemode, TRUE)
  92.   
  93.   set width = printObj(mGetPageWidth)
  94.   set height = printObj(mGetPageheight)
  95.   
  96.   printObj(mSetTextFont,"Times")
  97.   printObj(mSetTextSize,18)
  98.   printObj(mSetTextStyle,"normal")
  99.   
  100.   -- page header left side
  101.   if not(voidP(pictureTitle)) then
  102.     printObj(mSetTextJust,"left")
  103.     printObj(mDrawText, pictureTitle, 0, 8)
  104.   end if
  105.   
  106.   -- page header line underneath
  107.   printObj(mLine, 0, 11, width, 11)
  108.   
  109.   -- page footer left side
  110.   printObj(mSetTextSize,10)
  111.   printObj (mSetTextJust,"left")
  112.   printObj(mSetTextStyle,"normal")
  113.   printObj (mDrawText,"⌐1996 SoftKey Multimedia Inc., a subsidiary of SoftKey International Inc.",0,height-5)
  114.   
  115.   -- place the picture on the page
  116.   set pictureWidth = the width of cast pictureCast
  117.   set pictureHeight = the height of cast pictureCast
  118.   
  119.   -- center the picture
  120.   set topP = (height / 2) - (pictureHeight / 2)
  121.   set bottomP = (height / 2) + (pictureHeight / 2)
  122.   set rightP = (width / 2) + (pictureWidth / 2)
  123.   set leftP = (width / 2) - (pictureWidth / 2)
  124.   
  125.   -- scale the picture if necessary
  126.   if (pictureHeight >= 430) then -- too big to print 100%, scale down to 75%
  127.     set topP = integer(topP + 0.125 * pictureHeight)
  128.     set bottomP = integer(bottomP - 0.125 * pictureHeight)
  129.     set leftP = integer(leftP + 0.125 * pictureWidth)
  130.     set rightP = integer(rightP - 0.125 * pictureWidth)
  131.   end if
  132.   
  133.   -- place the caption on the page
  134.   if not(voidP(pictureCaption)) then
  135.     printObj(mSetTextJust,"left")
  136.     printObj(mSetTextSize,14)
  137.     printObj(mSetTextStyle,"normal,italic")
  138.     printObj(mDrawText, pictureCaption, 0, 30)
  139.   end if
  140.   
  141.   printObj(mNewPage)
  142.   
  143.   printObj(mPicture, the picture of cast pictureCast, leftP, topP, rightP, bottomP)
  144.   
  145.   -- register the xobject
  146.   printobj(mRegister, "PMAT130-013-01075")
  147.   
  148.   -- printObj(mPrintPreview)
  149.   printObj(mprint)
  150.   
  151.   printObj(mDispose)
  152. end
  153.  
  154. -- NOTE: THIS VERSION PRINTS LARGE PICTURES NOT IN LANDSCAPE MODE
  155.  
  156. on doPrintPicture printObj, pictureCast, pictureTitle, pictureCaption
  157.   
  158.   set pictureWidth = the width of cast pictureCast
  159.   set pictureHeight = the height of cast pictureCast
  160.   
  161.   if (pictureHeight >= 430) and (pictureWidth >= 600) then -- must print landscape
  162.     doPrintBGPicture printObj, pictureCast, pictureTitle, pictureCaption -- reduce to 75%
  163.     exit
  164.   end if
  165.   
  166.   printobj(mSetDocumentName, "Leonardo 2")
  167.   
  168.   printObj(mreset)
  169.   
  170.   if (pictureHeight >= 430) then -- too big to print landscape
  171.     printobj(msetlandscapemode, FALSE)
  172.   else
  173.     printobj(msetlandscapemode, TRUE)
  174.   end if
  175.   
  176.   set width = printObj(mGetPageWidth)
  177.   set height = printObj(mGetPageheight)
  178.   
  179.   printObj(mSetTextFont,"Times")
  180.   printObj(mSetTextSize,18)
  181.   printObj(mSetTextStyle,"normal")
  182.   
  183.   -- page header left side
  184.   if not(voidP(pictureTitle)) then
  185.     printObj(mSetTextJust,"left")
  186.     printObj(mDrawText, pictureTitle, 0, 8)
  187.   end if
  188.   
  189.   -- page header line underneath
  190.   printObj(mLine, 0, 11, width, 11)
  191.   
  192.   -- page footer left side
  193.   printObj(mSetTextSize,10)
  194.   printObj (mSetTextJust,"left")
  195.   printObj(mSetTextStyle,"normal")
  196.   printObj (mDrawText,"⌐1996 SoftKey Multimedia Inc., a subsidiary of SoftKey International Inc.",0,height-5)
  197.   
  198.   -- place the picture on the page
  199.   -- center the picture
  200.   set topP = (height / 2) - (pictureHeight / 2)
  201.   set bottomP = (height / 2) + (pictureHeight / 2)
  202.   set rightP = (width / 2) + (pictureWidth / 2)
  203.   set leftP = (width / 2) - (pictureWidth / 2)
  204.   
  205.   -- place the caption on the page
  206.   if not(voidP(pictureCaption)) then
  207.     printObj(mSetTextJust,"left")
  208.     printObj(mSetTextSize,14)
  209.     printObj(mSetTextStyle,"normal,italic")
  210.     printObj(mDrawText, pictureCaption, 0, 30)
  211.   end if
  212.   
  213.   printObj(mNewPage)
  214.   
  215.   printObj(mPicture, the picture of cast pictureCast, leftP, topP, rightP, bottomP)
  216.   
  217.   -- register the xobject
  218.   printobj(mRegister, "PMAT130-013-01075")
  219.   
  220.   --  printObj(mPrintPreview)
  221.   printObj(mprint)
  222.   
  223.   printObj(mDispose)
  224. end
  225.  
  226. -- ----------------------------------------------------------------
  227. -- Handler printingInvention returns TRUE if the user clicked the
  228. -- print button in the gallery or an old invention movie and FALSE
  229. -- otherwise.
  230.  
  231. on printingInvention
  232.   -- special clause for gallery movie so the dialog does not appear
  233.   -- in the index of the gallery 
  234.   return ((the movieName = "Gallery.dir") and notInGalleryIndex()) or (the movieName contains "I_") or (the movieName = "quizgam.dir")
  235. end
  236.  
  237. on notInGalleryIndex
  238.   return marker(0) >= label("AlarmClock")  
  239. end
  240.  
  241. -- ----------------------------------------------------------------
  242. -- Handler doPrintCardSize does the actual printing of the screen
  243. -- in four cards. It receives an instance of the printomatic xobj
  244. -- as a parameter (that was created in either printScreenMAC or printScreenPC).
  245.  
  246. on doPrintCardSize printobj, fullFileName
  247.   printobj(mSetDocumentName, "Leonardo 2")
  248.   
  249.   -- set up the new object:
  250.   -- 1) reset to page 1
  251.   printobj(mreset)
  252.   
  253.   -- 2) set landscape mode
  254.   printobj(msetlandscapemode, TRUE)
  255.   
  256.   -- 3) set the margins to as big as possible
  257.   set paperwidth = printobj(mgetpaperwidth)
  258.   set paperheight = printobj(mgetpaperheight)
  259.   
  260.   printobj(msetmargins, 0, 0, paperwidth, paperheight)
  261.   
  262.   -- 4) set the printable space to the margins
  263.   printobj(msetprintablemargins)
  264.   
  265.   set pageH = printobj(mgetpageheight)
  266.   set pageW = printobj(mgetpagewidth)
  267.   
  268.   -- 5) start a new page
  269.   printobj(mnewpage)
  270.   
  271.   -- 6) put the four screenshots on the page
  272.   if voidP(fullFileName) then -- printing the screen
  273.     -- 6a) top left card
  274.     -- don't know why i need a -25 here, it should be -10, but
  275.     -- that seems to print bigger than the other cards for some reason
  276.     printobj(mstagepicture, 0, 0, pageW / 2, (pageH / 2) - 10)
  277.     
  278.     -- 6b) bottom left card
  279.     printobj(mstagepicture, 0, pageH / 2,pageW / 2, pageH - 10)
  280.     
  281.     -- 6c) top right card
  282.     printobj(mstagepicture, pageW / 2, 0, pageW, (pageH / 2) - 10)
  283.     
  284.     -- 6d) bottom right card
  285.     printobj(mstagepicture, pageW / 2, pageH / 2, pageW, pageH - 10)
  286.     
  287.     -- 6e) page footer left side: copyright notice
  288.     set width = printObj(mGetPageWidth)
  289.     set height = printObj(mGetPageheight)
  290.     printObj(mSetTextSize,10)
  291.     printObj(mSetTextStyle,"normal")
  292.     printObj (mSetTextJust,"left")
  293.     printObj (mDrawText,"⌐1996 SoftKey Multimedia Inc., a subsidiary of SoftKey International Inc.",0,height-2)  
  294.   else -- printing a file
  295.     -- 6a) top left card
  296.     -- don't know why i need a -25 here, it should be -10, but
  297.     -- that seems to print bigger than the other cards for some reason
  298.     printobj(mpicture, fullFileName, 0, 0, pageW / 2, (pageH / 2) - 10)
  299.     
  300.     -- 6b) bottom left card
  301.     printobj(mpicture, fullFileName, 0, pageH / 2, pageW / 2, pageH - 10)
  302.     
  303.     -- 6c) top right card
  304.     printobj(mpicture, fullFileName, pageW / 2, 0, pageW, (pageH / 2) - 10)
  305.     
  306.     -- 6d) bottom right card
  307.     printobj(mpicture, fullFileName, pageW / 2, pageH / 2, pageW, pageH - 10)
  308.   end if
  309.   
  310.   -- 7) register the xobject
  311.   printobj(mRegister, "PMAT130-013-01075")
  312.   
  313.   --  printObj(mprintPreview)
  314.   
  315.   -- 8) print the page
  316.   printobj(mprint)
  317.   
  318.   -- 9) get rid of the object
  319.   printobj(mdispose)
  320. end